package com.boot.mgt.utils

import org.springframework.util.ResourceUtils
import java.text.SimpleDateFormat
import java.util.*


object SequenceUtil {

    @Volatile
    var SEQUENCE = 1

    fun init() {
        SEQUENCE = 1
    }

    fun addItion() {
        SEQUENCE += 1
    }

    fun get(): String {
        val sdf = SimpleDateFormat("yyyyMMdd")
        val dateStr = sdf.format(Date())
        when (SEQUENCE) {
            10 -> return "${dateStr}00$SEQUENCE"
            100 -> return "${dateStr}0$SEQUENCE"
            1000 -> return dateStr + SEQUENCE
        }
        return ""
    }
}